#!/usr/bin/ruby
$:.unshift File.join(File.dirname(__FILE__))
require 'AWS/SQS'
require 'basic_configuration'
require 'aws_context'
require 'pp'

# Create a queue.
# Apparently if you create another queue by the same name, it will return
#  the existing queue id.

if ARGV[0] == '-?' || ARGV.size != 1 then
	puts "usage: create-queue name"
	exit 1
end
name=ARGV[0]

Signal.trap("INT") do
  exit 2
end

config = BasicConfiguration.new
sqs = AwsContext.instance.sqs(*config.keys)
begin
  res = sqs.create_queue(name, 300)
  puts "created #{res}"
rescue
  puts "error #{$!} #{name}"
  exit 1
end

